#ifndef MESH_H
#define MESH_H

#include <glm/glm.hpp>
#include <cstdint>
#include <string>
#include <vector>
#include <IShader.h>
#include <memory>

struct Vertex
{
    glm::vec3 Position;
    glm::vec3 Normal;
};

class Mesh
{
public:
    std::vector<Vertex> vertices;
    std::vector<uint32_t> indices;

    Mesh(const std::vector<Vertex>& vertices, const std::vector<uint32_t>& indices);
    void Draw(const gl::IShader& shader) const;
    void SetWorldMatrix(const glm::mat4& mMat);
    void SetOffsetMatrix(const glm::mat4& mMat);
    void SetModelMatrix(const glm::mat4& mMat);

private:
    uint32_t VAO, VBO, EBO;
    glm::mat4 worldMatrix{};
    glm::mat4 offsetMatrix{};
    glm::mat4 modelMatrix{};
    void SetupMesh();

public:
    static std::shared_ptr<Mesh> LoadMeshFromFile(const std::string& path);
};


#endif //MESH_H
